﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using RecruitmentSystem.Business;
using RecruitmentSystem.Common;

public partial class StudentManagement_EditProfessionalDescription : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindBeginInfo();
        }
    }

    private void BindBeginInfo()
    {
        AccountManager am = new AccountManager();
        PersonalUser pu = (PersonalUser)am.GetUserById(User.Identity.Name, UserType.PersonalUser);
        txtProfessionalDescription.Text = pu.ProfessionaldescriptionAndSelfevaluation;
        txtWorkExperience.Text = pu.WorkexperienceAndDescription;
    }

    protected void ibtn_FinishEdit_Click(object sender, ImageClickEventArgs e)
    {
        if (txtProfessionalDescription.Text == "" || txtWorkExperience.Text == "")
        {
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "emptywarning", "<script type='txt/javascript'>alert('请确认带*号信息全部填写！');</script>");
        }
        else
        {
            AccountManager am = new AccountManager();
            PersonalUser pu = (PersonalUser)am.GetUserById(User.Identity.Name, UserType.PersonalUser);
            pu.ProfessionaldescriptionAndSelfevaluation = txtProfessionalDescription.Text;
            pu.WorkexperienceAndDescription = txtWorkExperience.Text;
            if (am.UpdateUser(pu))
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "added", "<script type='text/javascript'>alert('学生专业描述信息修改成功！');</script>");
                return;
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "failed", "<script type='text/javascript'>alert('学生专业描述信息修改未成功！');</script>");
                return;
            }
        }
    }
}
